<?php
	
	require_once(dirname(__FILE__)."/../core/safeParam.php");
	
	class module {
		
		function Add($vars) {
    		global $database;
    		$action['title']   = $vars['title'];
    		$action['date']    = $vars['date'];
    		$action['content'] = $vars['content'];
    		$action['rid']     = $vars['rid'];
    		
    		$database->insert_array('news', $action);
    		
    		header("Location: ../admin/index.php?edit=news&updated=1");
  		}
  		
  		function Edit($vars) {
    		global $database;
    		$action['title']   = $vars['title'];
    		$action['date']    = $vars['date'];
    		$action['content'] = $vars['content'];
    		$database->update_array('news', $action, "id = " . $vars['id'] . "");
    		header("Location: ../admin/index.php?edit=news&updated=1");
  		}
  		
  		function Delete($vars) {
    		global $database;
    		$database->delete('news', "id = " . $vars['id'] . "");
    		header("Location: ../admin/index.php?edit=news&updated=1");
  		}
	}
?>
